const { DataTypes } = require("sequelize");

const requelize = require("../db/sequelize");

const Region = requelize.define(
  "db_region",
  {
    id: {
      type: DataTypes.BIGINT(20),
      unique: true,
      primaryKey: true,
      comment: "ID",
    },
    title: {
      type: DataTypes.STRING(200),
      allowNull: false,
      comment: "名称",
    },
    pid: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "上级ID",
    },
    type: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: "1 省级 2 市级 3 区县级 4 乡镇街道级",
    },
    code: {
      type: DataTypes.BIGINT(20),
      allowNull: false,
      comment: "编码",
    },
    lat: {
      type: DataTypes.DECIMAL(16, 8),
      allowNull: true,
      comment: "经度",
    },
    lng: {
      type: DataTypes.DECIMAL(16, 8),
      allowNull: true,
      comment: "纬度",
    },
  
  },
  {
    tableName: "db_region",
    comment: "地区表",
    createdAt:false,
    updatedAt:false,
  }
);
// Region.sync({ force: true });
module.exports = Region;